<%@ page import="controllers.SolutionConnect"%>
<%@ page import="controllers.ajxBestOfSitesConnectServlet"%>
<%@ page import="java.util.List,java.text.*"%>
<%@ page import="java.util.List,java.util.HashMap"%>
<%@ page import="controllers.CommonConnect"%>
<%@ page import="controllers.ajxCustomerServlet"%>


<%
	String id = (String) request.getParameter("PID");
	String Action = (String) request.getParameter("Action");
	String CusName = "";
    String LableOfButtonSave = "Add Record";
    boolean Flg =false ; 
	ajxCustomerServlet Obj = new ajxCustomerServlet();
	if (id == null)
		id = "";
	if (Action == null)
		Action = "";
	if (Action.toUpperCase().trim().equalsIgnoreCase("UPDATE")) {
		CusName   =   Obj.GetCusname(Long.parseLong(id));
		LableOfButtonSave ="Update";
	} else if (Action.toUpperCase().trim().equalsIgnoreCase("DELETE")) {
		Flg = Obj.Delete(id);
	}

	CommonConnect Com = new CommonConnect();
	List<HashMap<String, Object>> rs = Com.getCustomer();
%>



<% if (Action.toUpperCase().trim().equalsIgnoreCase("DELETE") && Flg ==false) { %>
<script type="text/javascript"> 
    window.onload = Msg();
    function Msg()
    {
    	alert("This customer is aready used, if you need to delete please contact administrator");
    }
</script>
<%} %>




<div id="lotusContent">
	<br>
	<script src="/scripts/jquery.js" type="text/javascript"></script>
	<script src="/scripts/jquery.dataTables.min.js" type="text/javascript"></script>
	<script type="text/javascript">
        

      
        $(document).ready(function () {
            $("#draft").dataTable({
                "sPaginationType": "full_numbers",
                "bJQueryUI": true,
                "iDisplayLength": 50
            });
                       
        });
 </script>

<fieldset>
<legend>Customer</legend>
     
    <div style="padding: 20px;">
		<table>
			<tr>
				<Td>Customer Name :</Td>
				<td><input type="text" id="CustumerName" name="CustumerName" value="<%= CusName %>"
					width="300px"></td>
			</tr>
			<tr>
				<td></td>
				<td><br>
					<div>
						<span class="lotusBtn lotusBtnAction lotusLeft"> <a
							href="javascript:Submitsavvy()"><b><%=LableOfButtonSave %></b></a>
						</span> <span class="lotusBtn lotusBtnAction lotusLeft"> <a
							href="javascript:cancelsavvy()"><b>Reset</b></a>
						</span>

					</div></td>
			</tr>
		</table>
	</div>
</fieldset>
<fieldset>
<legend>List Of Customers</legend>
    <div id="dt_example" style="text-align: center;" >
		<div id="container">
			<div id="demo_jui">
				<table id="draft" class="display">
					<thead>
						<tr>
							<th>Customer Name</th>
							<th>Create By</th>
							<th>Edit</th>
							<th>Remove</th>
						</tr>
					</thead>
					<tbody>
						<%
							for (int i = 0; i < rs.size(); i++) {
						%>
						<tr>
							<td><%=rs.get(i).get("CustName")%></td>
							<td><%=rs.get(i).get("Create")%></td>
							<td><a href="/modules/admin/customer-admin.jsp?Action=Update&&PID=<%=rs.get(i).get("CustID")%>"> Edit</A></td>
                            <td><a  onclick="return verify()" href="/modules/admin/customer-admin.jsp?Action=Delete&&PID=<%=rs.get(i).get("CustID")%>"> Remove</A></td>
						</tr>
						<%
							}
						%>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</fieldset>
</div>
<input name="Action" type="hidden" value="<%=Action %>">
<input name="id" type="hidden" value="<%=id %>">


<!--End of Lotus Main-->
<!-- Footer gets moved to within Frame div in weblog.vm so closing tags need to go in weblog.vm - MTodd November 1 2007 </body> </html> -->
<input name="Remote_User" type="hidden" value="">
<input name="SaveOptions" type="hidden" value="0">
<input name="HTTP_Cookie" type="hidden"
	value="totalDocsrecommsols=142; __utma=88700297.683723686.1339743676.1344559297.1345078055.34; __utmz=88700297.1339743676.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); redirectto=/global/collaboration/savvysol.nsf/frmHome%3Fopenform; DomAuthSessId=9CAC08D0FC1F96BD8D086F8636AAC44B">
<input name="QuickSearch" type="hidden" value="0">
<input name="UserProfileInfo" type="hidden"
	value="DAC27D6D00FFC2FA8525765200021D84~6BE47A5E91FDD00E8525769D0074EA81~1F0D0776828A369C852576AB004DB2B9~189535317AC64EE385257665005FAC75~4628EE2C7B1ABC70862576880077E8BF~535C09333ABF01B485257654006B0E8D^Molex Connector Alignment Issues~Spray Fixture Elimination~Energy Consumption Reduction~DTV Process Re-layout~Reduce cosmetic and functional problems at PALM  final quality inspection~Reverse logistics capacity optimization model ^0~0~0~1~0~0^0~0~0~1~0~0">
<input name="txtProfileUNID" type="hidden" value="">